package com.newtouch.bxzs.business.personal.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.newtouch.bxzs.business.config.MyLog;
import com.newtouch.bxzs.business.personal.model.AddCustomerBirthdayRemindVO;
import com.newtouch.bxzs.business.personal.model.CustomerBirthdayRemindBO;
import com.newtouch.bxzs.business.personal.model.CustomerBirthdayRemindVO;
import com.newtouch.bxzs.business.personal.service.CustomerBirthdayRemindService;
import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * 客户生日提醒控制器
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021年3月22日</td>
 * <td>xiongdianqiang</td>
 * <td>Create</td>
 * </tr>
 * </table>
 * 
 * @author xiongdianqiang
 * 
 * @version 1.0.0
 * @since 1.0.0
 */
@RestController
@SuppressWarnings("unchecked")
@Api(tags = "客户生日提醒")
@RequestMapping(value = "/birthdayRemindController")
public class BirthdayRemindController {

	/** 静态变量：系统日志 */
	private static final Log logger = LogFactory.getLog(BirthdayRemindController.class);

	@Autowired
	private CustomerBirthdayRemindService customerBirthdayRemindService;

	@ApiOperation("获取客户生日提醒列表")
	@PostMapping(value = "/getBirthdayRemindList")
	@MyLog(systemFunctionName = "客户生日提醒", systemFunctionUrl = "/birthdayRemindController/getBirthdayRemindList", userOperationType = 4, userOperationSummary = "获取客户生日提醒列表")
	public BaseResponse<IPage<CustomerBirthdayRemindBO>> getCustomerBirthdayRemindList(
			@RequestBody CustomerBirthdayRemindVO customerbirthdayRemindVO) {
		logger.info("获取客户生日提醒列表");
		IPage<CustomerBirthdayRemindBO> customerBirthdayRemindList = customerBirthdayRemindService
				.getCustomerBirthdayRemindList(customerbirthdayRemindVO);
		return RespGenerator.returnOK(customerBirthdayRemindList);
	}

	@PostMapping(value = "/addBirthdayRemind")
	@ApiOperation("新建客户生日提醒")
	@MyLog(systemFunctionName = "客户生日提醒", systemFunctionUrl = "/birthdayRemindController/addBirthdayRemind", userOperationType = 1, userOperationSummary = "新建客户生日提醒")
	public BaseResponse<String> addCustomerBirthdayRemind(
			@RequestBody AddCustomerBirthdayRemindVO addCustomerBirthdayRemindVO) {
		logger.info("新建客户生日提醒");
		return RespGenerator
				.returnOK(customerBirthdayRemindService.addCustomerBirthdayRemind(addCustomerBirthdayRemindVO));
	}

	@PostMapping(value = "/deleteBirthdayRemind")
	@ApiOperation("删除客户生日提醒")
	@ApiImplicitParam(name = "customerBirthdayRemindId", value = "客户生日提醒id", paramType = "query", dataType = "String", required = true)
	@MyLog(systemFunctionName = "客户生日提醒", systemFunctionUrl = "/birthdayRemindController/deleteBirthdayRemind", userOperationType = 2, userOperationSummary = "删除客户生日提醒")
	public BaseResponse<String> deleteBirthdayRemind(
			@RequestParam(value = "customerBirthdayRemindId") String customerBirthdayRemindId) {
		logger.info("删除客户生日提醒");
		customerBirthdayRemindService.deleteCustomerBirthdayRemind(customerBirthdayRemindId);
		return RespGenerator.returnOK("成功！");
	}

}
